package ua.org.extjsbuilder.parser.runtime.data;

import ua.org.extjsbuilder.parser.JSObject;
import ua.org.extjsbuilder.parser.runtime.StringLiteralToken;

public class JSString implements JSObject {
	private String value;

	public JSString(StringLiteralToken literal) {
		this.value = literal.asJavaString();
	}

	public JSString(String value) {
		this.value = value;
	}

	@Override
	public boolean equals(Object obj) {
		if(obj instanceof String){
			return value.equals(obj);
		}
		if(obj instanceof JSString){
			return value.equals(((JSString)obj).value);
		}
		return false;
	}

	@Override
	public int hashCode() {
		return value.hashCode();
	}

	@Override
	public String toString() {
		return value;
	}
}
